home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / aijournl / 1986_10 / smallx3.bbs < prev    next >
File List  |  1986-04-14  |  896b  |  37 lines

  1.  
  2.  
  3. Iε thσ nex⌠ figurσ thσ Small-╪ rule≤ needeΣ t∩ reaΣ ß filσ anΣ ì
  4. accumulatσ thσ element≤ reaΣ int∩ ß lis⌠ i≤ shown.
  5.  
  6.         if not in-memory(#list) then
  7.         {
  8.         %
  9.         % initialize the list, open the input file and read an
  10.         % element of the list
  11.         %
  12.             bind #list []    
  13.             open 'data.fil' as infile for input
  14.             read file infile #element
  15.         }
  16.         [reader] if #element <> 'end of file' then
  17.         {
  18.         %
  19.         % as long as we have not reached the end of file add
  20.         % the element to the list and read another. Make this
  21.         % rule available to be fired again.
  22.         %
  23.             compute #list <- #list + #element
  24.             read file infile #element
  25.             reset reader
  26.         }
  27.         [halter] if #element = 'end of file' then
  28.         {
  29.         %
  30.         % when end of file is reached close the input file
  31.         % and halt the engine
  32.         %
  33.             close infile
  34.             halt
  35.         }
  36.  
  37.